VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "CrystalReport"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit
Private ReportFileName As String
Public SelectionFormula As String
Public Report As CRAXDDRT.Report
Private nombreRep As String
Private Accion As String
Private crApp As CRAXDRT.Application
Private tabla As CRAXDDRT.DatabaseTable
Public Enum Destination
    dacliPrinter = 1
    dacliScreen = 2
End Enum
Public Enum InternalReport
    multiples1 = 1
    multiples2 = 2
    multiples3 = 3
    multiples4 = 4
    Media1 = 5
    Media2 = 6
    Media3 = 7
    Media4 = 8
End Enum
Public destino As Destination
Private Function getReport(kindReport As Byte) As CRAXDDRT.Report
    Select Case kindReport
        Case multiples1
            Set getReport = RptMultiples
        Case multiples2
            Set getReport = RptMultiples2
        Case multiples3
            Set getReport = RptMultiples3
        Case multiples4
            Set getReport = RptMultiples4
        Case Media1
            Set getReport = RptMediaP
        Case Media2
            Set getReport = rptMediaP2
        Case Media3
            Set getReport = RptMediaP3
        Case Media4
            Set getReport = RptMediaP4
    End Select
End Function
Public Sub LoadExternal(externo As String)
    Set crApp = New CRAXDDRT.Application
    Set Report = crApp.OpenReport(externo)
    RefreshData
End Sub
Public Sub LoadInternal(ReportConf As Byte)
    Set Report = getReport(ReportConf)
    RefreshData
End Sub
Sub showReportPrinter()
    destino = dacliPrinter
    PrintReport
End Sub
Private Sub RefreshData()
    Report.DiscardSavedData
End Sub
Public Sub setParam(ByVal param As String, ByVal value As String)
On Error Resume Next
    Report.ParameterFields.GetItemByName(param).AddCurrentValue (value)
End Sub
Public Sub PrintReport()
    If Report Is Nothing Then Exit Sub
    If (Report.RecordSelectionFormula = "") Then Report.RecordSelectionFormula = SelectionFormula
    If LCase(Accion) = dacliPrinter Then
        Report.PrintOut False
        Exit Sub
    End If
    FrmReporte.CRViewer91.ReportSource = Report
    FrmReporte.CRViewer91.ViewReport
    FrmReporte.CRViewer91.Zoom 60 'porcentaje
    FrmReporte.Show vbModal
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Set Report = Nothing
    Set crApp = Nothing
End Sub

